<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    body {
      background: url('./images/desktop_1.jpg') no-repeat top center;
    }
  </style>
</head>

<body>
  <script>
    // 取到 N ~ M 的随机整数
    function random(n, m) {
      return Math.floor(Math.random() * (m - n + 1)) + n;
    }
    // 随机数
    // html ,head ,body ,title 唯一，是内置的对象 修改背景
    let body = document.body;
    console.log(body);
    body.style.background = `url('./images/desktop_${random(1, 10)}.jpg') no-repeat top center`
  </script>
</body>

</html>